import Vue from 'vue'
import App from './App.vue'
import axios from 'axios'
import Cookies from 'js-cookie'
import ElementUI from 'element-ui'
import customComponents from '@/components/load-components'
import process from 'process'
// 本地文件引入 -------------------------------------------------------
import store from '@/store'
import directive from './directive'
import plugins from './plugins'
import i18n from '@/i18n'
import { download, downloadMinio } from '@/utils/request'
import { addDateRange, handleTree, parseTime, resetForm, selectDictLabel, selectDictLabels } from '@/utils/common'
import router from '@/router'

// 引入全局组件 ----------------------------------------------------
import DictData from '@/components/dict-data/DictData'
import Pagination from '@/components/pagination/Pagination'
import RightToolbar from '@/components/right-toolbar/RightToolbar'
import Editor from '@/components/editor/Editor'
import FileUpload from '@/components/file-upload/FileUpload'
import ImageUpload from '@/components/image-upload/ImageUpload'
import ImagePreview from '@/components/image-preview/ImagePreview'
import DictTag from '@/components/dict-tag/DictTag'
import MapIcon from '@/components/map-icon/MapIcon'
import FormSearch from '@/components/formsearch/FormSearch'
import DataTable from '@/components/data-table/DataTable'
// 执行脚本和静态文件引入 -------------------------------------------
import './assets/icons'
import './permission'
import '@/assets/style/index.scss'
// Vue 相关组件、命令、插件注册 --------------------------------------
Vue.use(ElementUI)
Vue.use(directive)
Vue.use(plugins)
customComponents.install(Vue)
DictData.install()

// 全局组件注册 ----------------------------------------------------
Vue.component('DictTag', DictTag)
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)
Vue.component('Editor', Editor)
Vue.component('FileUpload', FileUpload)
Vue.component('ImageUpload', ImageUpload)
Vue.component('ImagePreview', ImagePreview)
Vue.component('FormSearch', FormSearch)
Vue.component('DataTable', DataTable)
Vue.component('MapIcon', MapIcon)
// 变量定义 -------------------------------------------------------
// 建议所有自定义原型变量加上 $ 符号，以便和组件内部方法做区分
Vue.config.productionTip = false
Vue.prototype.$axios = axios
Vue.prototype.$cookies = Cookies
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.handleTree = handleTree
Vue.prototype.download = download
Vue.prototype.downloadMinio = downloadMinio
Vue.prototype.$process = process
ElementUI.MessageBox.setDefaults({ closeOnClickModal: false })
ElementUI.Dialog.props.closeOnClickModal.default = false
// 运行 ---------------------------------------------------------
new Vue({
  i18n,
  router,
  store,
  render: h => h(App)
}).$mount('#app')
